Skip to content

fix(a2a): read long-running function name from data, not metadata#6296

Open
Osamaali313 wants to merge 4 commits into
google:mainfrom
Osamaali313:fix-a2a-euc-task-state
Open

fix(a2a): read long-running function name from data, not metadata#6296
Osamaali313 wants to merge 4 commits into
google:mainfrom
Osamaali313:fix-a2a-euc-task-state

Conversation

@Osamaali313

Copy link
Copy Markdown

Fixes #6295

Problem

LongRunningFunctions._mark_long_running_function_call sets the A2A task state for a long-running function call — auth_required for an End-User-Credential (EUC) request, input_required otherwise. It read the function name from the wrong dict:

# src/google/adk/a2a/converters/long_running_functions.py:163
if a2a_part.root.metadata.get("name") == REQUEST_EUC_FUNCTION_CALL_NAME:

For a function-call DataPart, the name lives in a2a_part.root.data (the FunctionCall dump — see part_converter.convert_genai_part_to_a2a_part: data=part.function_call.model_dump(...)). metadata only holds the ADK adk_type / adk_is_long_running keys, so metadata.get("name") is always None. The EUC branch is never taken, and a credential request is mislabeled input_required instead of auth_required.

The sibling converter already does this correctly:

# src/google/adk/a2a/converters/event_converter.py:504
and part.root.data.get("name") == REQUEST_EUC_FUNCTION_CALL_NAME

Fix

if a2a_part.root.data.get("name") == REQUEST_EUC_FUNCTION_CALL_NAME:

Tests

Added tests/unittests/a2a/converters/test_long_running_functions.py (there was no dedicated test — the executor test fully mocks LongRunningFunctions), asserting that an EUC request yields auth_required and a regular long-running function yields input_required.

Before the fix the EUC case fails (input_required); after, it passes. The full tests/unittests/a2a/converters/ suite passes (171 → 173 with the new tests).

_mark_long_running_function_call read the function name from the A2A
DataPart's metadata, but for a function-call part the name lives in
data (the FunctionCall dump); metadata only holds the adk_type /
adk_is_long_running keys. metadata.get("name") was therefore always
None, so an End-User-Credential request was mislabeled input_required
instead of auth_required. Read it from data, matching the equivalent
check in event_converter.py.
@rohityan rohityan added the a2a [Component] This issue is related a2a support inside ADK. label Jul 6, 2026
@rohityan rohityan added the needs review [Status] The PR/issue is awaiting review from the maintainer label Jul 8, 2026
@rohityan rohityan requested a review from wyf7107 July 8, 2026 23:04
@rohityan

rohityan commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Hi @Osamaali313 , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@rohityan

rohityan commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Hi @wyf7107 , can you please review this. LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a2a [Component] This issue is related a2a support inside ADK. needs review [Status] The PR/issue is awaiting review from the maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A2A long-running EUC request mislabeled input_required instead of auth_required (reads name from metadata, not data)

2 participants